package com.xyoto.community.controller;

import com.xyoto.community.aspect.annotation.RequiresLogin;
import com.xyoto.community.dto.StudentAuthenticationDTO;
import com.xyoto.community.service.StudentAuthenticationService;
import com.xyoto.community.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.IOException;

/**
 * @Author lin
 * @Date 2021/10/20 7:56
 */
@RestController
@RequestMapping("/studentAuthentication")
@Api(value = "studentAuthenticationController", tags = "学生认证接口")
public class StudentAuthenticationController {

    @Resource
    private StudentAuthenticationService authenticationService;

    /**
     * 学生认证
     * @param studentAuthentication 认证对象
     * @return
     */
    @RequiresLogin
    @ApiOperation("学生认证")
    @PostMapping("/saveStudentAuthentication")
    public Result saveStudentAuthentication(@Validated StudentAuthenticationDTO studentAuthentication,
                                            @RequestParam MultipartFile file) throws IOException {
        return authenticationService.saveStudentAuthentication(studentAuthentication,file);
    }

}
